{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# 人生苦短，我用python"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 为什么学 Python？\n",
    "\n",
    "**小组话题:** http://edu.cda.cn/group/19/thread/93\n",
    "\n",
    "## Python 评分最高\n",
    "\n",
    "http://pypl.github.io/PYPL.html\n",
    "\n",
    "## Python 能做的事情很多\n",
    "\n",
    "### 数据抓取\n",
    "\n",
    "你可以利用 Python 爬虫。\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>rank_num</th>\n",
       "      <th>movie_name</th>\n",
       "      <th>actors</th>\n",
       "      <th>release_time</th>\n",
       "      <th>score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>我不是药神</td>\n",
       "      <td>主演：徐峥,周一围,王传君</td>\n",
       "      <td>上映时间：2018-07-05</td>\n",
       "      <td>9.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>肖申克的救赎</td>\n",
       "      <td>主演：蒂姆·罗宾斯,摩根·弗里曼,鲍勃·冈顿</td>\n",
       "      <td>上映时间：1994-09-10(加拿大)</td>\n",
       "      <td>9.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>绿皮书</td>\n",
       "      <td>主演：维果·莫腾森,马赫沙拉·阿里,琳达·卡德里尼</td>\n",
       "      <td>上映时间：2019-03-01</td>\n",
       "      <td>9.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>海上钢琴师</td>\n",
       "      <td>主演：蒂姆·罗斯,比尔·努恩,克兰伦斯·威廉姆斯三世</td>\n",
       "      <td>上映时间：2019-11-15</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>哪吒之魔童降世</td>\n",
       "      <td>主演：吕艳婷,囧森瑟夫,瀚墨</td>\n",
       "      <td>上映时间：2019-07-26</td>\n",
       "      <td>9.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>小偷家族</td>\n",
       "      <td>主演：中川雅也,安藤樱,松冈茉优</td>\n",
       "      <td>上映时间：2018-08-03</td>\n",
       "      <td>8.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>霸王别姬</td>\n",
       "      <td>主演：张国荣,张丰毅,巩俐</td>\n",
       "      <td>上映时间：1993-07-26</td>\n",
       "      <td>9.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>美丽人生</td>\n",
       "      <td>主演：罗伯托·贝尼尼,朱斯蒂诺·杜拉诺,赛尔乔·比尼·布斯特里克</td>\n",
       "      <td>上映时间：2020-01-03</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>盗梦空间</td>\n",
       "      <td>主演：莱昂纳多·迪卡普里奥,渡边谦,约瑟夫·高登-莱维特</td>\n",
       "      <td>上映时间：2010-09-01</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>这个杀手不太冷</td>\n",
       "      <td>主演：让·雷诺,加里·奥德曼,娜塔莉·波特曼</td>\n",
       "      <td>上映时间：1994-09-14(法国)</td>\n",
       "      <td>9.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>11</td>\n",
       "      <td>怦然心动</td>\n",
       "      <td>主演：玛德琳·卡罗尔,卡兰·麦克奥利菲,艾丹•奎因</td>\n",
       "      <td>上映时间：2010-07-26(美国)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>12</td>\n",
       "      <td>星际穿越</td>\n",
       "      <td>主演：马修·麦康纳,安妮·海瑟薇,杰西卡·查斯坦</td>\n",
       "      <td>上映时间：2014-11-12</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>13</td>\n",
       "      <td>千与千寻</td>\n",
       "      <td>主演：柊瑠美,周冬雨,入野自由</td>\n",
       "      <td>上映时间：2019-06-21</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>14</td>\n",
       "      <td>阿甘正传</td>\n",
       "      <td>主演：汤姆·汉克斯,罗宾·怀特,加里·西尼斯</td>\n",
       "      <td>上映时间：1994-07-06(美国)</td>\n",
       "      <td>9.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>15</td>\n",
       "      <td>触不可及</td>\n",
       "      <td>主演：弗朗索瓦·克鲁塞,奥玛·希,安娜·勒尼</td>\n",
       "      <td>上映时间：2011-11-02(法国)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>16</td>\n",
       "      <td>楚门的世界</td>\n",
       "      <td>主演：金·凯瑞,劳拉·琳妮,诺亚·艾默里奇</td>\n",
       "      <td>上映时间：1998(罗马尼亚)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>17</td>\n",
       "      <td>寻梦环游记</td>\n",
       "      <td>主演：安东尼·冈萨雷斯,本杰明·布拉特,盖尔·加西亚·贝纳尔</td>\n",
       "      <td>上映时间：2017-11-24</td>\n",
       "      <td>9.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>18</td>\n",
       "      <td>辛德勒的名单</td>\n",
       "      <td>主演：连姆·尼森,拉尔夫·费因斯,本·金斯利</td>\n",
       "      <td>上映时间：1993-11-30(美国)</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>19</td>\n",
       "      <td>小丑</td>\n",
       "      <td>主演：华金·菲尼克斯,罗伯特·德尼罗,亚历克·鲍德温</td>\n",
       "      <td>上映时间：2019-10-04(美国)</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>20</td>\n",
       "      <td>摔跤吧！爸爸</td>\n",
       "      <td>主演：阿米尔·汗,沙克希·坦沃,法缇玛·萨那·纱卡</td>\n",
       "      <td>上映时间：2017-05-05</td>\n",
       "      <td>9.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>21</td>\n",
       "      <td>何以为家</td>\n",
       "      <td>主演：赞恩·阿尔·拉菲亚,约丹诺斯·希费罗,博鲁瓦蒂夫·特雷杰·班科尔</td>\n",
       "      <td>上映时间：2019-04-29</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>22</td>\n",
       "      <td>少年派的奇幻漂流</td>\n",
       "      <td>主演：苏拉·沙玛,伊尔凡·可汗,塔布</td>\n",
       "      <td>上映时间：2012-11-22</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>23</td>\n",
       "      <td>忠犬八公的故事</td>\n",
       "      <td>主演：Forest,理查·基尔,琼·艾伦</td>\n",
       "      <td>上映时间：2009-06-13(美国)</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>24</td>\n",
       "      <td>当幸福来敲门</td>\n",
       "      <td>主演：威尔·史密斯,贾登·史密斯,坦迪·牛顿</td>\n",
       "      <td>上映时间：2008-01-17</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>25</td>\n",
       "      <td>情书</td>\n",
       "      <td>主演：中山美穗,丰川悦司,范文雀</td>\n",
       "      <td>上映时间：1999-03</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>26</td>\n",
       "      <td>放牛班的春天</td>\n",
       "      <td>主演：热拉尔·朱尼奥,让-巴蒂斯特·莫尼耶,玛丽·布奈尔</td>\n",
       "      <td>上映时间：2004-10-16</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>27</td>\n",
       "      <td>龙猫</td>\n",
       "      <td>主演：秦岚,糸井重里,岛本须美</td>\n",
       "      <td>上映时间：2018-12-14</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>28</td>\n",
       "      <td>泰坦尼克号</td>\n",
       "      <td>主演：莱昂纳多·迪卡普里奥,凯特·温丝莱特,比利·赞恩</td>\n",
       "      <td>上映时间：1998-04-03</td>\n",
       "      <td>9.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>29</td>\n",
       "      <td>复仇者联盟4：终局之战</td>\n",
       "      <td>主演：小罗伯特·唐尼,克里斯·埃文斯,马克·鲁法洛</td>\n",
       "      <td>上映时间：2019-04-24</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>30</td>\n",
       "      <td>熔炉</td>\n",
       "      <td>主演：孔刘,郑有美,金智英</td>\n",
       "      <td>上映时间：2011-09-22(韩国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>31</td>\n",
       "      <td>三傻大闹宝莱坞</td>\n",
       "      <td>主演：阿米尔·汗,黄渤,卡琳娜·卡普</td>\n",
       "      <td>上映时间：2011-12-08</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>32</td>\n",
       "      <td>被嫌弃的松子的一生</td>\n",
       "      <td>主演：中谷美纪,永山瑛太,伊势谷友介</td>\n",
       "      <td>上映时间：2006-05-27(日本)</td>\n",
       "      <td>8.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>33</td>\n",
       "      <td>教父</td>\n",
       "      <td>主演：马龙·白兰度,阿尔·帕西诺,詹姆斯·肯恩</td>\n",
       "      <td>上映时间：2015-04-18</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>34</td>\n",
       "      <td>头号玩家</td>\n",
       "      <td>主演：泰伊·谢里丹,奥利维亚·库克,本·门德尔森</td>\n",
       "      <td>上映时间：2018-03-30</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>35</td>\n",
       "      <td>三块广告牌</td>\n",
       "      <td>主演：弗兰西斯·麦克多蒙德,伍迪·哈里森,山姆·洛克威尔</td>\n",
       "      <td>上映时间：2018-03-02</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>36</td>\n",
       "      <td>看不见的客人</td>\n",
       "      <td>主演：马里奥·卡萨斯,阿娜·瓦格纳,何塞·科罗纳多</td>\n",
       "      <td>上映时间：2017-09-15</td>\n",
       "      <td>9.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>37</td>\n",
       "      <td>疯狂动物城</td>\n",
       "      <td>主演：金妮弗·古德温,杰森·贝特曼,伊德瑞斯·艾尔巴</td>\n",
       "      <td>上映时间：2016-03-04</td>\n",
       "      <td>9.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>38</td>\n",
       "      <td>天堂电影院</td>\n",
       "      <td>主演：菲利浦·诺瓦雷,赛尔乔·卡斯特利托,蒂兹亚娜·罗达托</td>\n",
       "      <td>上映时间：1988-09-29(意大利)</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>39</td>\n",
       "      <td>活着</td>\n",
       "      <td>主演：葛优,巩俐,牛犇</td>\n",
       "      <td>上映时间：1994-05-17(法国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>40</td>\n",
       "      <td>死亡诗社</td>\n",
       "      <td>主演：罗宾·威廉姆斯,伊桑·霍克,柯特伍德·史密斯</td>\n",
       "      <td>上映时间：1989-06-02(加拿大)</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>41</td>\n",
       "      <td>请以你的名字呼唤我</td>\n",
       "      <td>主演：提莫西·查拉梅,艾米·汉莫,迈克尔·斯图巴</td>\n",
       "      <td>上映时间：2017-01-22(美国)</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>42</td>\n",
       "      <td>闻香识女人</td>\n",
       "      <td>主演：阿尔·帕西诺,克里斯·奥唐纳,加布里埃尔·安瓦尔</td>\n",
       "      <td>上映时间：1992-12-23(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>43</td>\n",
       "      <td>机器人总动员</td>\n",
       "      <td>主演：本·贝尔特,艾丽莎·奈特,杰夫·格尔林</td>\n",
       "      <td>上映时间：2008-06-27(美国)</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>44</td>\n",
       "      <td>末代皇帝</td>\n",
       "      <td>主演：尊龙,陈冲,彼得·奥图尔</td>\n",
       "      <td>上映时间：1987-10-04(日本)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>45</td>\n",
       "      <td>西西里的美丽传说</td>\n",
       "      <td>主演：莫妮卡·安娜·玛丽亚·贝鲁奇,朱塞佩·苏尔法罗,玛蒂尔德·皮亚纳</td>\n",
       "      <td>上映时间：2000-10-26(意大利)</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>46</td>\n",
       "      <td>窃听风暴</td>\n",
       "      <td>主演：乌尔里希·穆埃,塞巴斯蒂安·科赫,马蒂娜·格德克</td>\n",
       "      <td>上映时间：2006-03-23(德国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>47</td>\n",
       "      <td>本杰明·巴顿奇事</td>\n",
       "      <td>主演：布拉德·皮特,凯特·布兰切特,塔拉吉·P·汉森</td>\n",
       "      <td>上映时间：2008-12-25(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>48</td>\n",
       "      <td>飞越疯人院</td>\n",
       "      <td>主演：杰克·尼科尔森,路易丝·弗莱彻,威尔·萨姆森</td>\n",
       "      <td>上映时间：1975-11-19(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>49</td>\n",
       "      <td>美国往事</td>\n",
       "      <td>主演：罗伯特·德尼罗,詹姆斯·伍兹,伊丽莎白·麦戈文</td>\n",
       "      <td>上映时间：2015-04-23</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>50</td>\n",
       "      <td>搏击俱乐部</td>\n",
       "      <td>主演：爱德华·哈里森·诺顿,布拉德·皮特,海伦娜·伯翰·卡特</td>\n",
       "      <td>上映时间：1999-09-10(意大利)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>51</td>\n",
       "      <td>天使爱美丽</td>\n",
       "      <td>主演：奥黛丽·塔图,马修·卡索维茨,吕菲斯</td>\n",
       "      <td>上映时间：2001-04-25(比利时)</td>\n",
       "      <td>8.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>52</td>\n",
       "      <td>让子弹飞</td>\n",
       "      <td>主演：姜文,周润发,葛优</td>\n",
       "      <td>上映时间：2010-12-16</td>\n",
       "      <td>8.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>53</td>\n",
       "      <td>飞屋环游记</td>\n",
       "      <td>主演：爱德华·阿斯纳,乔丹·长井,鲍勃·彼德森</td>\n",
       "      <td>上映时间：2009-08-04</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>54</td>\n",
       "      <td>乱世佳人</td>\n",
       "      <td>主演：费雯·丽,克拉克·盖博,奥利维娅·德哈维兰</td>\n",
       "      <td>上映时间：1939-12-15(美国)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>55</td>\n",
       "      <td>菊次郎的夏天</td>\n",
       "      <td>主演：北野武,关口雄介,岸本 加世子</td>\n",
       "      <td>上映时间：2020-09-25</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>56</td>\n",
       "      <td>一一</td>\n",
       "      <td>主演：吴念真,金燕玲,李凯莉</td>\n",
       "      <td>上映时间：2017-07-28(中国台湾)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>57</td>\n",
       "      <td>美丽心灵</td>\n",
       "      <td>主演：罗素·克劳,詹妮弗·康纳利,艾德·哈里斯</td>\n",
       "      <td>上映时间：2001-12-13(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>58</td>\n",
       "      <td>蝴蝶效应</td>\n",
       "      <td>主演：阿什顿·库彻,约翰·帕特里克·阿梅多利,艾米·斯马特</td>\n",
       "      <td>上映时间：2004-01-23(美国)</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>59</td>\n",
       "      <td>大话西游之大圣娶亲</td>\n",
       "      <td>主演：周星驰,朱茵,莫文蔚</td>\n",
       "      <td>上映时间：2014-10-24</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>60</td>\n",
       "      <td>消失的爱人</td>\n",
       "      <td>主演：本·阿弗莱克,裴淳华,尼尔·帕特里克·哈里斯</td>\n",
       "      <td>上映时间：2014-09-26(美国)</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>61</td>\n",
       "      <td>罗马假日</td>\n",
       "      <td>主演：格利高里·派克,奥黛丽·赫本,埃迪·艾伯特</td>\n",
       "      <td>上映时间：1953-08-20(意大利)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>62</td>\n",
       "      <td>布达佩斯大饭店</td>\n",
       "      <td>主演：拉尔夫·费因斯,托尼·雷沃罗利,西尔莎·罗南</td>\n",
       "      <td>上映时间：2014-06-14</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>62</th>\n",
       "      <td>63</td>\n",
       "      <td>海边的曼彻斯特</td>\n",
       "      <td>主演：卡西·阿弗莱克,卢卡斯•赫奇斯,米歇尔·威廉姆斯</td>\n",
       "      <td>上映时间：2017-08-25</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63</th>\n",
       "      <td>64</td>\n",
       "      <td>低俗小说</td>\n",
       "      <td>主演：约翰·特拉沃尔塔,乌玛·瑟曼,塞缪尔·杰克逊</td>\n",
       "      <td>上映时间：1994-05-21(法国)</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>64</th>\n",
       "      <td>65</td>\n",
       "      <td>爱在黎明破晓前</td>\n",
       "      <td>主演：伊桑·霍克,朱莉·德尔佩,安德莉亚·埃克特</td>\n",
       "      <td>上映时间：1995-01-27(美国)</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>65</th>\n",
       "      <td>66</td>\n",
       "      <td>阿凡达</td>\n",
       "      <td>主演：萨姆·沃辛顿,佐伊·索尔达娜,米歇尔·罗德里格兹</td>\n",
       "      <td>上映时间：2010-01-04</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>66</th>\n",
       "      <td>67</td>\n",
       "      <td>七宗罪</td>\n",
       "      <td>主演：布拉德·皮特,摩根·弗里曼,格温妮斯·帕特洛</td>\n",
       "      <td>上映时间：1995-09-22(美国)</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67</th>\n",
       "      <td>68</td>\n",
       "      <td>超脱</td>\n",
       "      <td>主演：艾德里安·布洛迪,马西娅·盖伊·哈登,詹姆斯·肯恩</td>\n",
       "      <td>上映时间：2011-04-25(美国)</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>68</th>\n",
       "      <td>69</td>\n",
       "      <td>海蒂和爷爷</td>\n",
       "      <td>主演：阿努克·斯特芬,布鲁诺·甘茨,昆林·艾格匹</td>\n",
       "      <td>上映时间：2019-05-16</td>\n",
       "      <td>9.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>69</th>\n",
       "      <td>70</td>\n",
       "      <td>釜山行</td>\n",
       "      <td>主演：孔刘,郑有美,马东锡</td>\n",
       "      <td>上映时间：2016-05-13(法国)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70</th>\n",
       "      <td>71</td>\n",
       "      <td>波西米亚狂想曲</td>\n",
       "      <td>主演：拉米·马雷克,本·哈迪,约瑟夫•梅泽罗</td>\n",
       "      <td>上映时间：2019-03-22</td>\n",
       "      <td>9.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>72</td>\n",
       "      <td>春光乍泄</td>\n",
       "      <td>主演：张国荣,梁朝伟,张震</td>\n",
       "      <td>上映时间：1997-05-17(法国)</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>73</td>\n",
       "      <td>爱在日落黄昏时</td>\n",
       "      <td>主演：伊桑·霍克,朱莉·德尔佩,弗农·多布切夫</td>\n",
       "      <td>上映时间：2015-04-20</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73</th>\n",
       "      <td>74</td>\n",
       "      <td>天空之城</td>\n",
       "      <td>主演：寺田农,鹫尾真知子,龟山助清</td>\n",
       "      <td>上映时间：1992-05-01</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>75</td>\n",
       "      <td>辩护人</td>\n",
       "      <td>主演：宋康昊,郭度沅,吴达洙</td>\n",
       "      <td>上映时间：2013-12-18(韩国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>76</td>\n",
       "      <td>剪刀手爱德华</td>\n",
       "      <td>主演：约翰尼·德普,薇诺娜·瑞德,黛安娜·威斯特</td>\n",
       "      <td>上映时间：1990-12-06(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>77</td>\n",
       "      <td>无间道</td>\n",
       "      <td>主演：刘德华,梁朝伟,黄秋生</td>\n",
       "      <td>上映时间：2003-09-05</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>77</th>\n",
       "      <td>78</td>\n",
       "      <td>网络谜踪</td>\n",
       "      <td>主演：约翰·赵,米切尔·拉,黛博拉·梅辛</td>\n",
       "      <td>上映时间：2018-12-14</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>79</td>\n",
       "      <td>穿条纹睡衣的男孩</td>\n",
       "      <td>主演：阿沙·巴特菲尔德,维拉·法梅加,大卫·休里斯</td>\n",
       "      <td>上映时间：2008-08-28(英国)</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79</th>\n",
       "      <td>80</td>\n",
       "      <td>蜘蛛侠：平行宇宙</td>\n",
       "      <td>主演：沙梅克·摩尔,彭昱畅,杰克·M·约翰森</td>\n",
       "      <td>上映时间：2018-12-21</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>80</th>\n",
       "      <td>81</td>\n",
       "      <td>心灵捕手</td>\n",
       "      <td>主演：罗宾·威廉姆斯,马特·达蒙,明妮·德里弗</td>\n",
       "      <td>上映时间：1997-12-05(美国)</td>\n",
       "      <td>8.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>82</td>\n",
       "      <td>重庆森林</td>\n",
       "      <td>主演：梁朝伟,王菲,金城武</td>\n",
       "      <td>上映时间：1994-07-14(中国香港)</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>83</td>\n",
       "      <td>素媛</td>\n",
       "      <td>主演：李甄,薛耿求,严智苑</td>\n",
       "      <td>上映时间：2013-10-02(韩国)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83</th>\n",
       "      <td>84</td>\n",
       "      <td>断背山</td>\n",
       "      <td>主演：希斯·莱杰,杰克·吉伦哈尔,米歇尔·威廉姆斯</td>\n",
       "      <td>上映时间：2005-09-02(意大利)</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>84</th>\n",
       "      <td>85</td>\n",
       "      <td>致命魔术</td>\n",
       "      <td>主演：休·杰克曼,克里斯蒂安·贝尔,迈克尔·凯恩</td>\n",
       "      <td>上映时间：2006-10-17(意大利)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85</th>\n",
       "      <td>86</td>\n",
       "      <td>蝙蝠侠：黑暗骑士</td>\n",
       "      <td>主演：克里斯蒂安·贝尔,希斯·莱杰,阿伦·伊克哈特</td>\n",
       "      <td>上映时间：2008-07-14(阿根廷)</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>86</th>\n",
       "      <td>87</td>\n",
       "      <td>十二怒汉</td>\n",
       "      <td>主演：亨利·方达,李·科布,马丁·鲍尔萨姆</td>\n",
       "      <td>上映时间：1957-04-13(美国)</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87</th>\n",
       "      <td>88</td>\n",
       "      <td>两杆大烟枪</td>\n",
       "      <td>主演：杰森·弗莱明,德克斯特·弗莱彻,杰森•斯坦森</td>\n",
       "      <td>上映时间：1998-08-28(英国)</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>88</th>\n",
       "      <td>89</td>\n",
       "      <td>控方证人</td>\n",
       "      <td>主演：泰隆·鲍华,玛琳·黛德丽,查尔斯·劳顿</td>\n",
       "      <td>上映时间：1957-12-17(美国)</td>\n",
       "      <td>8.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>90</td>\n",
       "      <td>1917</td>\n",
       "      <td>主演：乔治·麦凯,迪恩·查尔斯·查普曼,马克·斯特朗</td>\n",
       "      <td>上映时间：2020-08-07</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>91</td>\n",
       "      <td>大鱼</td>\n",
       "      <td>主演：伊万·麦克格雷格,阿尔伯特·芬尼,杰西卡·兰格</td>\n",
       "      <td>上映时间：2003-12-04(美国)</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>92</td>\n",
       "      <td>血战钢锯岭</td>\n",
       "      <td>主演：安德鲁·加菲尔德,雨果·维文,卢克·布雷西</td>\n",
       "      <td>上映时间：2016-12-08</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>93</td>\n",
       "      <td>奇迹男孩</td>\n",
       "      <td>主演：雅各布·特瑞布雷,朱莉娅·罗伯茨,欧文·威尔逊</td>\n",
       "      <td>上映时间：2018-01-19</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>94</td>\n",
       "      <td>真爱至上</td>\n",
       "      <td>主演：休·格兰特,比尔·奈伊,连姆·尼森</td>\n",
       "      <td>上映时间：2003-11-21(英国)</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>94</th>\n",
       "      <td>95</td>\n",
       "      <td>饮食男女</td>\n",
       "      <td>主演：郎雄,吴倩莲,杨贵媚</td>\n",
       "      <td>上映时间：1994-08-03(美国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>96</td>\n",
       "      <td>猫鼠游戏</td>\n",
       "      <td>主演：莱昂纳多·迪卡普里奥,汤姆·汉克斯,克里斯托弗·沃肯</td>\n",
       "      <td>上映时间：2003-04-11</td>\n",
       "      <td>8.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>97</td>\n",
       "      <td>模仿游戏</td>\n",
       "      <td>主演：本尼迪克特·康伯巴奇,凯拉·奈特莉,马修·古迪</td>\n",
       "      <td>上映时间：2015-07-21</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>98</td>\n",
       "      <td>爱尔兰人</td>\n",
       "      <td>主演：罗伯特·德尼罗,阿尔·帕西诺,乔·佩西</td>\n",
       "      <td>上映时间：2019-11-27(美国)</td>\n",
       "      <td>8.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>99</td>\n",
       "      <td>时空恋旅人</td>\n",
       "      <td>主演：瑞秋·麦克亚当斯,多姆纳尔·格里森,比尔·奈伊</td>\n",
       "      <td>上映时间：2013-09-04(英国)</td>\n",
       "      <td>8.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>100</td>\n",
       "      <td>黑天鹅</td>\n",
       "      <td>主演：娜塔莉·波特曼,文森特·卡索,米拉·库妮丝</td>\n",
       "      <td>上映时间：2010-09-01(意大利)</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   rank_num   movie_name                               actors  \\\n",
       "0         1        我不是药神                        主演：徐峥,周一围,王传君   \n",
       "1         2       肖申克的救赎               主演：蒂姆·罗宾斯,摩根·弗里曼,鲍勃·冈顿   \n",
       "2         3          绿皮书            主演：维果·莫腾森,马赫沙拉·阿里,琳达·卡德里尼   \n",
       "3         4        海上钢琴师           主演：蒂姆·罗斯,比尔·努恩,克兰伦斯·威廉姆斯三世   \n",
       "4         5      哪吒之魔童降世                       主演：吕艳婷,囧森瑟夫,瀚墨   \n",
       "5         6         小偷家族                     主演：中川雅也,安藤樱,松冈茉优   \n",
       "6         7         霸王别姬                        主演：张国荣,张丰毅,巩俐   \n",
       "7         8         美丽人生     主演：罗伯托·贝尼尼,朱斯蒂诺·杜拉诺,赛尔乔·比尼·布斯特里克   \n",
       "8         9         盗梦空间         主演：莱昂纳多·迪卡普里奥,渡边谦,约瑟夫·高登-莱维特   \n",
       "9        10      这个杀手不太冷               主演：让·雷诺,加里·奥德曼,娜塔莉·波特曼   \n",
       "10       11         怦然心动            主演：玛德琳·卡罗尔,卡兰·麦克奥利菲,艾丹•奎因   \n",
       "11       12         星际穿越             主演：马修·麦康纳,安妮·海瑟薇,杰西卡·查斯坦   \n",
       "12       13         千与千寻                      主演：柊瑠美,周冬雨,入野自由   \n",
       "13       14         阿甘正传               主演：汤姆·汉克斯,罗宾·怀特,加里·西尼斯   \n",
       "14       15         触不可及               主演：弗朗索瓦·克鲁塞,奥玛·希,安娜·勒尼   \n",
       "15       16        楚门的世界                主演：金·凯瑞,劳拉·琳妮,诺亚·艾默里奇   \n",
       "16       17        寻梦环游记       主演：安东尼·冈萨雷斯,本杰明·布拉特,盖尔·加西亚·贝纳尔   \n",
       "17       18       辛德勒的名单               主演：连姆·尼森,拉尔夫·费因斯,本·金斯利   \n",
       "18       19           小丑           主演：华金·菲尼克斯,罗伯特·德尼罗,亚历克·鲍德温   \n",
       "19       20       摔跤吧！爸爸            主演：阿米尔·汗,沙克希·坦沃,法缇玛·萨那·纱卡   \n",
       "20       21         何以为家  主演：赞恩·阿尔·拉菲亚,约丹诺斯·希费罗,博鲁瓦蒂夫·特雷杰·班科尔   \n",
       "21       22     少年派的奇幻漂流                   主演：苏拉·沙玛,伊尔凡·可汗,塔布   \n",
       "22       23      忠犬八公的故事                 主演：Forest,理查·基尔,琼·艾伦   \n",
       "23       24       当幸福来敲门               主演：威尔·史密斯,贾登·史密斯,坦迪·牛顿   \n",
       "24       25           情书                     主演：中山美穗,丰川悦司,范文雀   \n",
       "25       26       放牛班的春天         主演：热拉尔·朱尼奥,让-巴蒂斯特·莫尼耶,玛丽·布奈尔   \n",
       "26       27           龙猫                      主演：秦岚,糸井重里,岛本须美   \n",
       "27       28        泰坦尼克号          主演：莱昂纳多·迪卡普里奥,凯特·温丝莱特,比利·赞恩   \n",
       "28       29  复仇者联盟4：终局之战            主演：小罗伯特·唐尼,克里斯·埃文斯,马克·鲁法洛   \n",
       "29       30           熔炉                        主演：孔刘,郑有美,金智英   \n",
       "30       31      三傻大闹宝莱坞                   主演：阿米尔·汗,黄渤,卡琳娜·卡普   \n",
       "31       32    被嫌弃的松子的一生                   主演：中谷美纪,永山瑛太,伊势谷友介   \n",
       "32       33           教父              主演：马龙·白兰度,阿尔·帕西诺,詹姆斯·肯恩   \n",
       "33       34         头号玩家             主演：泰伊·谢里丹,奥利维亚·库克,本·门德尔森   \n",
       "34       35        三块广告牌         主演：弗兰西斯·麦克多蒙德,伍迪·哈里森,山姆·洛克威尔   \n",
       "35       36       看不见的客人            主演：马里奥·卡萨斯,阿娜·瓦格纳,何塞·科罗纳多   \n",
       "36       37        疯狂动物城           主演：金妮弗·古德温,杰森·贝特曼,伊德瑞斯·艾尔巴   \n",
       "37       38        天堂电影院        主演：菲利浦·诺瓦雷,赛尔乔·卡斯特利托,蒂兹亚娜·罗达托   \n",
       "38       39           活着                          主演：葛优,巩俐,牛犇   \n",
       "39       40         死亡诗社            主演：罗宾·威廉姆斯,伊桑·霍克,柯特伍德·史密斯   \n",
       "40       41    请以你的名字呼唤我             主演：提莫西·查拉梅,艾米·汉莫,迈克尔·斯图巴   \n",
       "41       42        闻香识女人          主演：阿尔·帕西诺,克里斯·奥唐纳,加布里埃尔·安瓦尔   \n",
       "42       43       机器人总动员               主演：本·贝尔特,艾丽莎·奈特,杰夫·格尔林   \n",
       "43       44         末代皇帝                      主演：尊龙,陈冲,彼得·奥图尔   \n",
       "44       45     西西里的美丽传说  主演：莫妮卡·安娜·玛丽亚·贝鲁奇,朱塞佩·苏尔法罗,玛蒂尔德·皮亚纳   \n",
       "45       46         窃听风暴          主演：乌尔里希·穆埃,塞巴斯蒂安·科赫,马蒂娜·格德克   \n",
       "46       47     本杰明·巴顿奇事           主演：布拉德·皮特,凯特·布兰切特,塔拉吉·P·汉森   \n",
       "47       48        飞越疯人院            主演：杰克·尼科尔森,路易丝·弗莱彻,威尔·萨姆森   \n",
       "48       49         美国往事           主演：罗伯特·德尼罗,詹姆斯·伍兹,伊丽莎白·麦戈文   \n",
       "49       50        搏击俱乐部       主演：爱德华·哈里森·诺顿,布拉德·皮特,海伦娜·伯翰·卡特   \n",
       "50       51        天使爱美丽                主演：奥黛丽·塔图,马修·卡索维茨,吕菲斯   \n",
       "51       52         让子弹飞                         主演：姜文,周润发,葛优   \n",
       "52       53        飞屋环游记              主演：爱德华·阿斯纳,乔丹·长井,鲍勃·彼德森   \n",
       "53       54         乱世佳人             主演：费雯·丽,克拉克·盖博,奥利维娅·德哈维兰   \n",
       "54       55       菊次郎的夏天                   主演：北野武,关口雄介,岸本 加世子   \n",
       "55       56           一一                       主演：吴念真,金燕玲,李凯莉   \n",
       "56       57         美丽心灵              主演：罗素·克劳,詹妮弗·康纳利,艾德·哈里斯   \n",
       "57       58         蝴蝶效应        主演：阿什顿·库彻,约翰·帕特里克·阿梅多利,艾米·斯马特   \n",
       "58       59    大话西游之大圣娶亲                        主演：周星驰,朱茵,莫文蔚   \n",
       "59       60        消失的爱人            主演：本·阿弗莱克,裴淳华,尼尔·帕特里克·哈里斯   \n",
       "60       61         罗马假日             主演：格利高里·派克,奥黛丽·赫本,埃迪·艾伯特   \n",
       "61       62      布达佩斯大饭店            主演：拉尔夫·费因斯,托尼·雷沃罗利,西尔莎·罗南   \n",
       "62       63      海边的曼彻斯特          主演：卡西·阿弗莱克,卢卡斯•赫奇斯,米歇尔·威廉姆斯   \n",
       "63       64         低俗小说            主演：约翰·特拉沃尔塔,乌玛·瑟曼,塞缪尔·杰克逊   \n",
       "64       65      爱在黎明破晓前             主演：伊桑·霍克,朱莉·德尔佩,安德莉亚·埃克特   \n",
       "65       66          阿凡达          主演：萨姆·沃辛顿,佐伊·索尔达娜,米歇尔·罗德里格兹   \n",
       "66       67          七宗罪            主演：布拉德·皮特,摩根·弗里曼,格温妮斯·帕特洛   \n",
       "67       68           超脱         主演：艾德里安·布洛迪,马西娅·盖伊·哈登,詹姆斯·肯恩   \n",
       "68       69        海蒂和爷爷             主演：阿努克·斯特芬,布鲁诺·甘茨,昆林·艾格匹   \n",
       "69       70          釜山行                        主演：孔刘,郑有美,马东锡   \n",
       "70       71      波西米亚狂想曲               主演：拉米·马雷克,本·哈迪,约瑟夫•梅泽罗   \n",
       "71       72         春光乍泄                        主演：张国荣,梁朝伟,张震   \n",
       "72       73      爱在日落黄昏时              主演：伊桑·霍克,朱莉·德尔佩,弗农·多布切夫   \n",
       "73       74         天空之城                    主演：寺田农,鹫尾真知子,龟山助清   \n",
       "74       75          辩护人                       主演：宋康昊,郭度沅,吴达洙   \n",
       "75       76       剪刀手爱德华             主演：约翰尼·德普,薇诺娜·瑞德,黛安娜·威斯特   \n",
       "76       77          无间道                       主演：刘德华,梁朝伟,黄秋生   \n",
       "77       78         网络谜踪                 主演：约翰·赵,米切尔·拉,黛博拉·梅辛   \n",
       "78       79     穿条纹睡衣的男孩            主演：阿沙·巴特菲尔德,维拉·法梅加,大卫·休里斯   \n",
       "79       80     蜘蛛侠：平行宇宙               主演：沙梅克·摩尔,彭昱畅,杰克·M·约翰森   \n",
       "80       81         心灵捕手              主演：罗宾·威廉姆斯,马特·达蒙,明妮·德里弗   \n",
       "81       82         重庆森林                        主演：梁朝伟,王菲,金城武   \n",
       "82       83           素媛                        主演：李甄,薛耿求,严智苑   \n",
       "83       84          断背山            主演：希斯·莱杰,杰克·吉伦哈尔,米歇尔·威廉姆斯   \n",
       "84       85         致命魔术             主演：休·杰克曼,克里斯蒂安·贝尔,迈克尔·凯恩   \n",
       "85       86     蝙蝠侠：黑暗骑士            主演：克里斯蒂安·贝尔,希斯·莱杰,阿伦·伊克哈特   \n",
       "86       87         十二怒汉                主演：亨利·方达,李·科布,马丁·鲍尔萨姆   \n",
       "87       88        两杆大烟枪            主演：杰森·弗莱明,德克斯特·弗莱彻,杰森•斯坦森   \n",
       "88       89         控方证人               主演：泰隆·鲍华,玛琳·黛德丽,查尔斯·劳顿   \n",
       "89       90         1917           主演：乔治·麦凯,迪恩·查尔斯·查普曼,马克·斯特朗   \n",
       "90       91           大鱼           主演：伊万·麦克格雷格,阿尔伯特·芬尼,杰西卡·兰格   \n",
       "91       92        血战钢锯岭             主演：安德鲁·加菲尔德,雨果·维文,卢克·布雷西   \n",
       "92       93         奇迹男孩           主演：雅各布·特瑞布雷,朱莉娅·罗伯茨,欧文·威尔逊   \n",
       "93       94         真爱至上                 主演：休·格兰特,比尔·奈伊,连姆·尼森   \n",
       "94       95         饮食男女                        主演：郎雄,吴倩莲,杨贵媚   \n",
       "95       96         猫鼠游戏        主演：莱昂纳多·迪卡普里奥,汤姆·汉克斯,克里斯托弗·沃肯   \n",
       "96       97         模仿游戏           主演：本尼迪克特·康伯巴奇,凯拉·奈特莉,马修·古迪   \n",
       "97       98         爱尔兰人               主演：罗伯特·德尼罗,阿尔·帕西诺,乔·佩西   \n",
       "98       99        时空恋旅人           主演：瑞秋·麦克亚当斯,多姆纳尔·格里森,比尔·奈伊   \n",
       "99      100          黑天鹅             主演：娜塔莉·波特曼,文森特·卡索,米拉·库妮丝   \n",
       "\n",
       "             release_time score  \n",
       "0         上映时间：2018-07-05   9.6  \n",
       "1    上映时间：1994-09-10(加拿大)   9.5  \n",
       "2         上映时间：2019-03-01   9.5  \n",
       "3         上映时间：2019-11-15   9.3  \n",
       "4         上映时间：2019-07-26   9.6  \n",
       "5         上映时间：2018-08-03   8.1  \n",
       "6         上映时间：1993-07-26   9.5  \n",
       "7         上映时间：2020-01-03   9.3  \n",
       "8         上映时间：2010-09-01   9.0  \n",
       "9     上映时间：1994-09-14(法国)   9.4  \n",
       "10    上映时间：2010-07-26(美国)   8.9  \n",
       "11        上映时间：2014-11-12   9.3  \n",
       "12        上映时间：2019-06-21   9.3  \n",
       "13    上映时间：1994-07-06(美国)   9.4  \n",
       "14    上映时间：2011-11-02(法国)   9.1  \n",
       "15        上映时间：1998(罗马尼亚)   8.9  \n",
       "16        上映时间：2017-11-24   9.6  \n",
       "17    上映时间：1993-11-30(美国)   9.2  \n",
       "18    上映时间：2019-10-04(美国)   8.6  \n",
       "19        上映时间：2017-05-05   9.8  \n",
       "20        上映时间：2019-04-29   9.3  \n",
       "21        上映时间：2012-11-22   9.0  \n",
       "22    上映时间：2009-06-13(美国)   9.3  \n",
       "23        上映时间：2008-01-17   9.3  \n",
       "24           上映时间：1999-03   8.7  \n",
       "25        上映时间：2004-10-16   8.8  \n",
       "26        上映时间：2018-12-14   9.2  \n",
       "27        上映时间：1998-04-03   9.4  \n",
       "28        上映时间：2019-04-24   9.1  \n",
       "29    上映时间：2011-09-22(韩国)   8.8  \n",
       "30        上映时间：2011-12-08   9.1  \n",
       "31    上映时间：2006-05-27(日本)   8.5  \n",
       "32        上映时间：2015-04-18   9.3  \n",
       "33        上映时间：2018-03-30   9.0  \n",
       "34        上映时间：2018-03-02   8.6  \n",
       "35        上映时间：2017-09-15   9.4  \n",
       "36        上映时间：2016-03-04   9.5  \n",
       "37   上映时间：1988-09-29(意大利)   9.2  \n",
       "38    上映时间：1994-05-17(法国)   9.0  \n",
       "39   上映时间：1989-06-02(加拿大)   8.7  \n",
       "40    上映时间：2017-01-22(美国)   8.0  \n",
       "41    上映时间：1992-12-23(美国)   8.8  \n",
       "42    上映时间：2008-06-27(美国)   9.3  \n",
       "43    上映时间：1987-10-04(日本)   8.8  \n",
       "44   上映时间：2000-10-26(意大利)   8.2  \n",
       "45    上映时间：2006-03-23(德国)   9.0  \n",
       "46    上映时间：2008-12-25(美国)   8.8  \n",
       "47    上映时间：1975-11-19(美国)   8.8  \n",
       "48        上映时间：2015-04-23   9.1  \n",
       "49   上映时间：1999-09-10(意大利)   8.8  \n",
       "50   上映时间：2001-04-25(比利时)   8.4  \n",
       "51        上映时间：2010-12-16   8.4  \n",
       "52        上映时间：2009-08-04   8.9  \n",
       "53    上映时间：1939-12-15(美国)   9.1  \n",
       "54        上映时间：2020-09-25   8.8  \n",
       "55  上映时间：2017-07-28(中国台湾)   8.9  \n",
       "56    上映时间：2001-12-13(美国)   8.8  \n",
       "57    上映时间：2004-01-23(美国)   8.7  \n",
       "58        上映时间：2014-10-24   8.8  \n",
       "59    上映时间：2014-09-26(美国)   8.7  \n",
       "60   上映时间：1953-08-20(意大利)   9.1  \n",
       "61        上映时间：2014-06-14   8.7  \n",
       "62        上映时间：2017-08-25   8.8  \n",
       "63    上映时间：1994-05-21(法国)   8.6  \n",
       "64    上映时间：1995-01-27(美国)   8.7  \n",
       "65        上映时间：2010-01-04   8.9  \n",
       "66    上映时间：1995-09-22(美国)   8.7  \n",
       "67    上映时间：2011-04-25(美国)   8.7  \n",
       "68        上映时间：2019-05-16   9.5  \n",
       "69    上映时间：2016-05-13(法国)   8.9  \n",
       "70        上映时间：2019-03-22   9.4  \n",
       "71    上映时间：1997-05-17(法国)   9.2  \n",
       "72        上映时间：2015-04-20   8.7  \n",
       "73        上映时间：1992-05-01   9.0  \n",
       "74    上映时间：2013-12-18(韩国)   8.8  \n",
       "75    上映时间：1990-12-06(美国)   8.8  \n",
       "76        上映时间：2003-09-05   9.1  \n",
       "77        上映时间：2018-12-14   8.6  \n",
       "78    上映时间：2008-08-28(英国)   9.0  \n",
       "79        上映时间：2018-12-21   8.8  \n",
       "80    上映时间：1997-12-05(美国)   8.3  \n",
       "81  上映时间：1994-07-14(中国香港)   8.6  \n",
       "82    上映时间：2013-10-02(韩国)   9.1  \n",
       "83   上映时间：2005-09-02(意大利)   8.9  \n",
       "84   上映时间：2006-10-17(意大利)   8.8  \n",
       "85   上映时间：2008-07-14(阿根廷)   9.3  \n",
       "86    上映时间：1957-04-13(美国)   9.1  \n",
       "87    上映时间：1998-08-28(英国)   8.7  \n",
       "88    上映时间：1957-12-17(美国)   8.5  \n",
       "89        上映时间：2020-08-07   8.6  \n",
       "90    上映时间：2003-12-04(美国)   8.6  \n",
       "91        上映时间：2016-12-08   9.3  \n",
       "92        上映时间：2018-01-19   9.2  \n",
       "93    上映时间：2003-11-21(英国)   8.6  \n",
       "94    上映时间：1994-08-03(美国)   8.8  \n",
       "95        上映时间：2003-04-11   8.5  \n",
       "96        上映时间：2015-07-21   9.3  \n",
       "97    上映时间：2019-11-27(美国)   8.5  \n",
       "98    上映时间：2013-09-04(英国)   8.8  \n",
       "99   上映时间：2010-09-01(意大利)   8.7  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 导入包\n",
    "import pandas as pd \n",
    "import requests\n",
    "import re\n",
    "import parsel\n",
    "from fake_useragent import UserAgent\n",
    "pd.set_option('display.max_rows', 500)\n",
    "\n",
    "def get_one_paeg(url):\n",
    "    '''功能：给定URL，获取猫眼top一页信息''' \n",
    "    headers = {'user-agent': UserAgent().random} \n",
    "    # 发起请求\n",
    "    r = requests.get(url, headers=headers) \n",
    "    # 解析数据\n",
    "    html = parsel.Selector(r.text) \n",
    "\n",
    "    # 获取数据\n",
    "    rank_num = html.xpath('//dd/i/text()').extract()\n",
    "    movie_name = html.xpath('//dd//p[@class=\"name\"]/a/text()').extract()\n",
    "    actors = [i.strip() for i in html.xpath('//dd//p[@class=\"star\"]/text()').extract()]\n",
    "    release_time = html.xpath('//dd//p[@class=\"releasetime\"]/text()').extract()\n",
    "    score = [''.join(re.findall(r' class=\"integer\">(.*?)</i><i class=\"fraction\">(.*?)</i></p>', i)[0])\n",
    "             for i in html.xpath('//dd//p[@class=\"score\"]').extract()]\n",
    "    \n",
    "    # 存储数据\n",
    "    df = pd.DataFrame({'rank_num': rank_num,\n",
    "                       'movie_name': movie_name,\n",
    "                       'actors': actors,\n",
    "                       'release_time': release_time,\n",
    "                       'score': score\n",
    "                          })\n",
    "    return df\n",
    "\n",
    "def get_10_page():\n",
    "    '''功能：给定URL，获取猫眼top100信息''' \n",
    "    df_all = pd.DataFrame()\n",
    "    \n",
    "    for i in range(10):\n",
    "        url = 'https://maoyan.com/board/4?requestCode=c06dbd0a6668891afe228d7763aac187zkdsc&offset={}'.format(i*10)\n",
    "        df_one = get_one_paeg(url)\n",
    "        df_all = df_all.append(df_one, ignore_index=True)\n",
    "\n",
    "    return df_all\n",
    "\n",
    "\n",
    "df_all = get_10_page()\n",
    "df_all.to_csv('maoyan.csv', index=False) \n",
    "df_all"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数据处理\n",
    "\n",
    "你可以利用 Python 处理数据，尤其是海量数据，Excel 打开都困难的，EXCEL 2016最多是104856行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已经全部完成\n",
      "Empty DataFrame\n",
      "Columns: []\n",
      "Index: []\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "df = pd.DataFrame()\n",
    "for i in os.listdir('./Excel_Files/files/'):\n",
    "    print(i)\n",
    "    df = df.append(pd.read_csv('./Excel_Files/files/' + i))\n",
    "# data = pd.concat(fs)\n",
    "print('已经全部完成')\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数据可视化\n",
    "\n",
    "你可以利用 Python 将数据转化成图，更加形象生动。\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"11fcd16b4f16432b89423155efc7b61d\" style=\"width:1350px; height:750px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_11fcd16b4f16432b89423155efc7b61d = echarts.init(\n",
       "                    document.getElementById('11fcd16b4f16432b89423155efc7b61d'), 'white', {renderer: 'canvas'});\n",
       "                var option_11fcd16b4f16432b89423155efc7b61d = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#FAE927\",\n",
       "        \"#E9E416\",\n",
       "        \"#C9DA36\",\n",
       "        \"#9ECB3C\",\n",
       "        \"#6DBC49\",\n",
       "        \"#37B44E\",\n",
       "        \"#3DBA78\",\n",
       "        \"#14ADCF\",\n",
       "        \"#209AC9\",\n",
       "        \"#1E91CA\",\n",
       "        \"#2C6BA0\",\n",
       "        \"#2B55A1\",\n",
       "        \"#2D3D8E\",\n",
       "        \"#44388E\",\n",
       "        \"#6A368B#7D3990\",\n",
       "        \"#A63F98\",\n",
       "        \"#C31C88\",\n",
       "        \"#D52178\",\n",
       "        \"#D5225B\",\n",
       "        \"#D02C2A\",\n",
       "        \"#D44C2D\",\n",
       "        \"#F57A34\",\n",
       "        \"#FA8F2F\",\n",
       "        \"#D99D21\",\n",
       "        \"#CF7B25\",\n",
       "        \"#CF7B25\",\n",
       "        \"#CF7B25\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"clockwise\": true,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u897f\\u85cf\",\n",
       "                    \"value\": 42\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6fb3\\u95e8\",\n",
       "                    \"value\": 37\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9752\\u6d77\",\n",
       "                    \"value\": 35\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u5dde\",\n",
       "                    \"value\": 24\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65b0\\u7586\",\n",
       "                    \"value\": 23\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u82cf\",\n",
       "                    \"value\": 22\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5185\\u8499\\u53e4\",\n",
       "                    \"value\": 22\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9655\\u897f\",\n",
       "                    \"value\": 21\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d77\\u5357\",\n",
       "                    \"value\": 21\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e91\\u5357\",\n",
       "                    \"value\": 20\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5409\\u6797\",\n",
       "                    \"value\": 17\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u897f\",\n",
       "                    \"value\": 16\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u91cd\\u5e86\",\n",
       "                    \"value\": 16\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u897f\",\n",
       "                    \"value\": 16\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u798f\\u5efa\",\n",
       "                    \"value\": 14\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u897f\",\n",
       "                    \"value\": 13\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b89\\u5fbd\",\n",
       "                    \"value\": 13\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u5317\",\n",
       "                    \"value\": 13\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5929\\u6d25\",\n",
       "                    \"value\": 13\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e56\\u5357\",\n",
       "                    \"value\": 12\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8fbd\\u5b81\",\n",
       "                    \"value\": 9\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b81\\u590f\",\n",
       "                    \"value\": 8\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d59\\u6c5f\",\n",
       "                    \"value\": 7\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u56db\\u5ddd\",\n",
       "                    \"value\": 7\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e0a\\u6d77\",\n",
       "                    \"value\": 1\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9ed1\\u9f99\\u6c5f\",\n",
       "                    \"value\": 1\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u4eac\",\n",
       "                    \"value\": 1\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": [\n",
       "                \"30%\",\n",
       "                \"135%\"\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"50%\",\n",
       "                \"65%\"\n",
       "            ],\n",
       "            \"roseType\": \"area\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"inside\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12,\n",
       "                \"fontStyle\": \"italic\",\n",
       "                \"fontWeight\": \"bold\",\n",
       "                \"fontFamily\": \"Microsoft YaHei\",\n",
       "                \"formatter\": \"{b}:{c}\\u5929\"\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u897f\\u85cf\",\n",
       "                \"\\u6fb3\\u95e8\",\n",
       "                \"\\u9752\\u6d77\",\n",
       "                \"\\u8d35\\u5dde\",\n",
       "                \"\\u65b0\\u7586\",\n",
       "                \"\\u6c5f\\u82cf\",\n",
       "                \"\\u5185\\u8499\\u53e4\",\n",
       "                \"\\u9655\\u897f\",\n",
       "                \"\\u6d77\\u5357\",\n",
       "                \"\\u4e91\\u5357\",\n",
       "                \"\\u5409\\u6797\",\n",
       "                \"\\u5c71\\u897f\",\n",
       "                \"\\u91cd\\u5e86\",\n",
       "                \"\\u5e7f\\u897f\",\n",
       "                \"\\u798f\\u5efa\",\n",
       "                \"\\u6c5f\\u897f\",\n",
       "                \"\\u5b89\\u5fbd\",\n",
       "                \"\\u6cb3\\u5317\",\n",
       "                \"\\u5929\\u6d25\",\n",
       "                \"\\u6e56\\u5357\",\n",
       "                \"\\u8fbd\\u5b81\",\n",
       "                \"\\u5b81\\u590f\",\n",
       "                \"\\u6d59\\u6c5f\",\n",
       "                \"\\u56db\\u5ddd\",\n",
       "                \"\\u4e0a\\u6d77\",\n",
       "                \"\\u9ed1\\u9f99\\u6c5f\",\n",
       "                \"\\u5317\\u4eac\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": false,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\t\\t\\t\\t\\t\\t\\t\\u591a\\u7701\\u5e02\\n\\u786e\\u8bca\\u75c5\\u4f8b\\u8fde\\u7eed\\u591a\\u65e5\",\n",
       "            \"subtext\": \"\\t\\t\\t\\u96f6\\u65b0\\u589e\",\n",
       "            \"left\": \"42.5%\",\n",
       "            \"right\": \"50%\",\n",
       "            \"top\": \"60%\",\n",
       "            \"bottom\": \"50%\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 25\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"fontStyle\": \"normal\",\n",
       "                \"fontFamily\": \"monospace\",\n",
       "                \"fontSize\": 30,\n",
       "                \"backgroundColor\": \"red\",\n",
       "                \"rich\": {\n",
       "                    \"color\": \"red\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_11fcd16b4f16432b89423155efc7b61d.setOption(option_11fcd16b4f16432b89423155efc7b61d);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1e443d170d0>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 使用pyecharts绘制南丁格尔玫瑰图\n",
    "\n",
    "# 导入包\n",
    "from pyecharts.charts import Pie\n",
    "from pyecharts import options as opts\n",
    "\n",
    "# 准备数据：省份和对应的连续多日疫情零新增数量、颜色序列\n",
    "provinces = ['西藏', '澳门', '青海', '贵州', '新疆',\n",
    "             '江苏', '内蒙古', '陕西', '海南', '云南',\n",
    "             '吉林', '山西', '重庆', '广西', '福建',\n",
    "             '江西', '安徽', '河北', '天津', '湖南',\n",
    "             '辽宁', '宁夏', '浙江', '四川', '上海',\n",
    "             '黑龙江', '北京']\n",
    "number = [42, 37, 35, 24, 23, 22, 22, 21, 21, 20, 17, 16, 16,\n",
    "       16, 14, 13, 13, 13, 13, 12, 9, 8, 7, 7, 1, 1, 1]\n",
    "color_series = ['#FAE927','#E9E416','#C9DA36','#9ECB3C','#6DBC49',\n",
    "              '#37B44E','#3DBA78','#14ADCF','#209AC9','#1E91CA',\n",
    "              '#2C6BA0','#2B55A1','#2D3D8E','#44388E','#6A368B'\n",
    "              '#7D3990','#A63F98','#C31C88','#D52178','#D5225B',\n",
    "              '#D02C2A','#D44C2D','#F57A34','#FA8F2F','#D99D21',\n",
    "              '#CF7B25','#CF7B25','#CF7B25']\n",
    "\n",
    "# 创建饼图\n",
    "pie = Pie(init_opts=opts.InitOpts(width='1350px', height='750px'))\n",
    "\n",
    "# 添加数据\n",
    "pie.add(\"\", [list(z) for z in zip(provinces, number)],\n",
    "        radius=[\"30%\", \"135%\"],\n",
    "        center=[\"50%\", \"65%\"],\n",
    "        rosetype=\"area\"\n",
    "        )\n",
    "\n",
    "# 设置全局配置\n",
    "pie.set_global_opts(title_opts=opts.TitleOpts(title='\\t\\t\\t\\t\\t\\t\\t多省市\\n确诊病例连续多日',\n",
    "                                              subtitle='\\t\\t\\t零新增',\n",
    "                                              pos_left='42.5%', pos_right='50%',\n",
    "                                              pos_top='60%', pos_bottom='50%',\n",
    "                                              title_textstyle_opts=opts.TextStyleOpts(font_size=25),\n",
    "                                              subtitle_textstyle_opts=opts.TextStyleOpts(font_size=30,\n",
    "                                                                                         font_family='monospace',\n",
    "                                                                                         font_style='normal',\n",
    "                                                                                         background_color='red',\n",
    "                                                                                         rich={'color': 'red'})\n",
    "                                              ),\n",
    "                    legend_opts=opts.LegendOpts(is_show=False)\n",
    "                   )\n",
    "\n",
    "# 设置系列配置和颜色\n",
    "pie.set_series_opts(label_opts=opts.LabelOpts(\n",
    "                    is_show=True, position=\"inside\", font_size=12,\n",
    "                    formatter=\"{b}:{c}天\", font_style=\"italic\",\n",
    "                    font_weight=\"bold\", font_family=\"Microsoft YaHei\"\n",
    "                                              )\n",
    "                    )\n",
    "\n",
    "pie.set_colors(color_series)\n",
    "\n",
    "# 在网页生成图片\n",
    "# pie.render('南丁格尔玫瑰图.html') \n",
    "pie.render_notebook() "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数据挖掘\n",
    "\n",
    "你可以利用 Python 从数据中找到更深层次的信息。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n",
       "<!-- Generated by graphviz version 2.44.2~dev.20201112.1525 (20201112.1525)\r\n",
       " -->\r\n",
       "<!-- Title: Tree Pages: 1 -->\r\n",
       "<svg width=\"572pt\" height=\"433pt\"\r\n",
       " viewBox=\"0.00 0.00 572.00 433.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 429)\">\r\n",
       "<title>Tree</title>\r\n",
       "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-429 568,-429 568,4 -4,4\"/>\r\n",
       "<!-- 0 -->\r\n",
       "<g id=\"node1\" class=\"node\">\r\n",
       "<title>0</title>\r\n",
       "<path fill=\"#ffffff\" stroke=\"black\" d=\"M277.5,-425C277.5,-425 127.5,-425 127.5,-425 121.5,-425 115.5,-419 115.5,-413 115.5,-413 115.5,-354 115.5,-354 115.5,-348 121.5,-342 127.5,-342 127.5,-342 277.5,-342 277.5,-342 283.5,-342 289.5,-348 289.5,-354 289.5,-354 289.5,-413 289.5,-413 289.5,-419 283.5,-425 277.5,-425\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"202.5\" y=\"-409.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">petal length (cm) &lt;= 2.45</text>\r\n",
       "<text text-anchor=\"middle\" x=\"202.5\" y=\"-394.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 1.585</text>\r\n",
       "<text text-anchor=\"middle\" x=\"202.5\" y=\"-379.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 150</text>\r\n",
       "<text text-anchor=\"middle\" x=\"202.5\" y=\"-364.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [50, 50, 50]</text>\r\n",
       "<text text-anchor=\"middle\" x=\"202.5\" y=\"-349.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = setosa</text>\r\n",
       "</g>\r\n",
       "<!-- 1 -->\r\n",
       "<g id=\"node2\" class=\"node\">\r\n",
       "<title>1</title>\r\n",
       "<path fill=\"#e58139\" stroke=\"black\" d=\"M170,-298.5C170,-298.5 73,-298.5 73,-298.5 67,-298.5 61,-292.5 61,-286.5 61,-286.5 61,-242.5 61,-242.5 61,-236.5 67,-230.5 73,-230.5 73,-230.5 170,-230.5 170,-230.5 176,-230.5 182,-236.5 182,-242.5 182,-242.5 182,-286.5 182,-286.5 182,-292.5 176,-298.5 170,-298.5\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"121.5\" y=\"-283.3\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.0</text>\r\n",
       "<text text-anchor=\"middle\" x=\"121.5\" y=\"-268.3\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 50</text>\r\n",
       "<text text-anchor=\"middle\" x=\"121.5\" y=\"-253.3\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [50, 0, 0]</text>\r\n",
       "<text text-anchor=\"middle\" x=\"121.5\" y=\"-238.3\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = setosa</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;1 -->\r\n",
       "<g id=\"edge1\" class=\"edge\">\r\n",
       "<title>0:&#45;&gt;1:</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M174.4,-341.91C166.61,-330.65 158.14,-318.42 150.3,-307.11\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"153.03,-304.9 144.46,-298.67 147.28,-308.88 153.03,-304.9\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"139.99\" y=\"-319.56\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">True</text>\r\n",
       "</g>\r\n",
       "<!-- 2 -->\r\n",
       "<g id=\"node3\" class=\"node\">\r\n",
       "<title>2</title>\r\n",
       "<path fill=\"#ffffff\" stroke=\"black\" d=\"M356.5,-306C356.5,-306 212.5,-306 212.5,-306 206.5,-306 200.5,-300 200.5,-294 200.5,-294 200.5,-235 200.5,-235 200.5,-229 206.5,-223 212.5,-223 212.5,-223 356.5,-223 356.5,-223 362.5,-223 368.5,-229 368.5,-235 368.5,-235 368.5,-294 368.5,-294 368.5,-300 362.5,-306 356.5,-306\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"284.5\" y=\"-290.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">petal width (cm) &lt;= 1.75</text>\r\n",
       "<text text-anchor=\"middle\" x=\"284.5\" y=\"-275.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 1.0</text>\r\n",
       "<text text-anchor=\"middle\" x=\"284.5\" y=\"-260.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 100</text>\r\n",
       "<text text-anchor=\"middle\" x=\"284.5\" y=\"-245.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 50, 50]</text>\r\n",
       "<text text-anchor=\"middle\" x=\"284.5\" y=\"-230.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = versicolor</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;2 -->\r\n",
       "<g id=\"edge2\" class=\"edge\">\r\n",
       "<title>0:&#45;&gt;2:</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M230.95,-341.91C237.18,-333.01 243.84,-323.51 250.28,-314.33\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"253.23,-316.22 256.1,-306.02 247.5,-312.2 253.23,-316.22\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"260.43\" y=\"-326.94\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">False</text>\r\n",
       "</g>\r\n",
       "<!-- 3 -->\r\n",
       "<g id=\"node4\" class=\"node\">\r\n",
       "<title>3</title>\r\n",
       "<path fill=\"#4de88e\" stroke=\"black\" d=\"M263.5,-187C263.5,-187 113.5,-187 113.5,-187 107.5,-187 101.5,-181 101.5,-175 101.5,-175 101.5,-116 101.5,-116 101.5,-110 107.5,-104 113.5,-104 113.5,-104 263.5,-104 263.5,-104 269.5,-104 275.5,-110 275.5,-116 275.5,-116 275.5,-175 275.5,-175 275.5,-181 269.5,-187 263.5,-187\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"188.5\" y=\"-171.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">petal length (cm) &lt;= 4.95</text>\r\n",
       "<text text-anchor=\"middle\" x=\"188.5\" y=\"-156.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.445</text>\r\n",
       "<text text-anchor=\"middle\" x=\"188.5\" y=\"-141.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 54</text>\r\n",
       "<text text-anchor=\"middle\" x=\"188.5\" y=\"-126.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 49, 5]</text>\r\n",
       "<text text-anchor=\"middle\" x=\"188.5\" y=\"-111.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = versicolor</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;3 -->\r\n",
       "<g id=\"edge3\" class=\"edge\">\r\n",
       "<title>2:&#45;&gt;3:</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M251.19,-222.91C243.75,-213.83 235.78,-204.12 228.11,-194.77\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"230.8,-192.53 221.75,-187.02 225.39,-196.97 230.8,-192.53\"/>\r\n",
       "</g>\r\n",
       "<!-- 6 -->\r\n",
       "<g id=\"node7\" class=\"node\">\r\n",
       "<title>6</title>\r\n",
       "<path fill=\"#843de6\" stroke=\"black\" d=\"M455.5,-187C455.5,-187 305.5,-187 305.5,-187 299.5,-187 293.5,-181 293.5,-175 293.5,-175 293.5,-116 293.5,-116 293.5,-110 299.5,-104 305.5,-104 305.5,-104 455.5,-104 455.5,-104 461.5,-104 467.5,-110 467.5,-116 467.5,-116 467.5,-175 467.5,-175 467.5,-181 461.5,-187 455.5,-187\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"380.5\" y=\"-171.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">petal length (cm) &lt;= 4.85</text>\r\n",
       "<text text-anchor=\"middle\" x=\"380.5\" y=\"-156.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.151</text>\r\n",
       "<text text-anchor=\"middle\" x=\"380.5\" y=\"-141.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 46</text>\r\n",
       "<text text-anchor=\"middle\" x=\"380.5\" y=\"-126.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 1, 45]</text>\r\n",
       "<text text-anchor=\"middle\" x=\"380.5\" y=\"-111.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = virginica</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;6 -->\r\n",
       "<g id=\"edge6\" class=\"edge\">\r\n",
       "<title>2:&#45;&gt;6:</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M317.81,-222.91C325.25,-213.83 333.22,-204.12 340.89,-194.77\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"343.61,-196.97 347.25,-187.02 338.2,-192.53 343.61,-196.97\"/>\r\n",
       "</g>\r\n",
       "<!-- 4 -->\r\n",
       "<g id=\"node5\" class=\"node\">\r\n",
       "<title>4</title>\r\n",
       "<path fill=\"#3de684\" stroke=\"black\" d=\"M115,-68C115,-68 12,-68 12,-68 6,-68 0,-62 0,-56 0,-56 0,-12 0,-12 0,-6 6,0 12,0 12,0 115,0 115,0 121,0 127,-6 127,-12 127,-12 127,-56 127,-56 127,-62 121,-68 115,-68\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"63.5\" y=\"-52.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.146</text>\r\n",
       "<text text-anchor=\"middle\" x=\"63.5\" y=\"-37.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 48</text>\r\n",
       "<text text-anchor=\"middle\" x=\"63.5\" y=\"-22.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 47, 1]</text>\r\n",
       "<text text-anchor=\"middle\" x=\"63.5\" y=\"-7.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = versicolor</text>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;4 -->\r\n",
       "<g id=\"edge4\" class=\"edge\">\r\n",
       "<title>3:&#45;&gt;4:</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M141.95,-103.73C131.23,-94.33 119.83,-84.35 109.15,-74.99\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"111.34,-72.26 101.51,-68.3 106.73,-77.52 111.34,-72.26\"/>\r\n",
       "</g>\r\n",
       "<!-- 5 -->\r\n",
       "<g id=\"node6\" class=\"node\">\r\n",
       "<title>5</title>\r\n",
       "<path fill=\"#c09cf2\" stroke=\"black\" d=\"M249.5,-68C249.5,-68 157.5,-68 157.5,-68 151.5,-68 145.5,-62 145.5,-56 145.5,-56 145.5,-12 145.5,-12 145.5,-6 151.5,0 157.5,0 157.5,0 249.5,0 249.5,0 255.5,0 261.5,-6 261.5,-12 261.5,-12 261.5,-56 261.5,-56 261.5,-62 255.5,-68 249.5,-68\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"203.5\" y=\"-52.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.918</text>\r\n",
       "<text text-anchor=\"middle\" x=\"203.5\" y=\"-37.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 6</text>\r\n",
       "<text text-anchor=\"middle\" x=\"203.5\" y=\"-22.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 2, 4]</text>\r\n",
       "<text text-anchor=\"middle\" x=\"203.5\" y=\"-7.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = virginica</text>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;5 -->\r\n",
       "<g id=\"edge5\" class=\"edge\">\r\n",
       "<title>3:&#45;&gt;5:</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M194.09,-103.73C195.22,-95.43 196.42,-86.67 197.57,-78.28\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"201.05,-78.68 198.94,-68.3 194.11,-77.73 201.05,-78.68\"/>\r\n",
       "</g>\r\n",
       "<!-- 7 -->\r\n",
       "<g id=\"node8\" class=\"node\">\r\n",
       "<title>7</title>\r\n",
       "<path fill=\"#c09cf2\" stroke=\"black\" d=\"M412.5,-68C412.5,-68 320.5,-68 320.5,-68 314.5,-68 308.5,-62 308.5,-56 308.5,-56 308.5,-12 308.5,-12 308.5,-6 314.5,0 320.5,0 320.5,0 412.5,0 412.5,0 418.5,0 424.5,-6 424.5,-12 424.5,-12 424.5,-56 424.5,-56 424.5,-62 418.5,-68 412.5,-68\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"366.5\" y=\"-52.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.918</text>\r\n",
       "<text text-anchor=\"middle\" x=\"366.5\" y=\"-37.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 3</text>\r\n",
       "<text text-anchor=\"middle\" x=\"366.5\" y=\"-22.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 1, 2]</text>\r\n",
       "<text text-anchor=\"middle\" x=\"366.5\" y=\"-7.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = virginica</text>\r\n",
       "</g>\r\n",
       "<!-- 6&#45;&gt;7 -->\r\n",
       "<g id=\"edge7\" class=\"edge\">\r\n",
       "<title>6:&#45;&gt;7:</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M375.29,-103.73C374.23,-95.43 373.11,-86.67 372.03,-78.28\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"375.5,-77.77 370.76,-68.3 368.55,-78.66 375.5,-77.77\"/>\r\n",
       "</g>\r\n",
       "<!-- 8 -->\r\n",
       "<g id=\"node9\" class=\"node\">\r\n",
       "<title>8</title>\r\n",
       "<path fill=\"#8139e5\" stroke=\"black\" d=\"M552,-68C552,-68 455,-68 455,-68 449,-68 443,-62 443,-56 443,-56 443,-12 443,-12 443,-6 449,0 455,0 455,0 552,0 552,0 558,0 564,-6 564,-12 564,-12 564,-56 564,-56 564,-62 558,-68 552,-68\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"503.5\" y=\"-52.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">entropy = 0.0</text>\r\n",
       "<text text-anchor=\"middle\" x=\"503.5\" y=\"-37.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">samples = 43</text>\r\n",
       "<text text-anchor=\"middle\" x=\"503.5\" y=\"-22.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">value = [0, 0, 43]</text>\r\n",
       "<text text-anchor=\"middle\" x=\"503.5\" y=\"-7.8\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">class = virginica</text>\r\n",
       "</g>\r\n",
       "<!-- 6&#45;&gt;8 -->\r\n",
       "<g id=\"edge8\" class=\"edge\">\r\n",
       "<title>6:&#45;&gt;8:</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M426.3,-103.73C436.85,-94.33 448.07,-84.35 458.58,-74.99\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"460.95,-77.56 466.09,-68.3 456.3,-72.33 460.95,-77.56\"/>\r\n",
       "</g>\r\n",
       "</g>\r\n",
       "</svg>\r\n"
      ],
      "text/plain": [
       "<graphviz.files.Source at 0x1ad45629e50>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.datasets import load_iris\n",
    "from sklearn import tree\n",
    "import graphviz\n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "\n",
    "iris = load_iris()\n",
    "\n",
    "# 建立决策树\n",
    "clf = DecisionTreeClassifier(criterion='entropy', max_depth=3) \n",
    "clf = clf.fit(iris.data, iris.target)\n",
    "\n",
    "# 可视化\n",
    "# 决策树可视化\n",
    "dot_data = tree.export_graphviz(decision_tree=clf,\n",
    "                                 out_file=None, \n",
    "                                 feature_names=iris.feature_names,\n",
    "                                 class_names=iris.target_names, \n",
    "                                 filled=True,\n",
    "                                 rounded=True\n",
    "                                )\n",
    "graph = graphviz.Source(dot_data)\n",
    "graph"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 自动化办公：一样的工作，你要花1小时，我只要 10 秒钟"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A公司合同完成\n",
      "B公司合同完成\n",
      "C公司合同完成\n",
      "D公司合同完成\n",
      "E公司合同完成\n",
      "F公司合同完成\n",
      "G公司合同完成\n",
      "H公司合同完成\n",
      "I公司合同完成\n",
      "J公司合同完成\n",
      "K公司合同完成\n",
      "L公司合同完成\n",
      "M公司合同完成\n",
      "N公司合同完成\n",
      "O公司合同完成\n",
      "P公司合同完成\n",
      "Q公司合同完成\n",
      "R公司合同完成\n"
     ]
    }
   ],
   "source": [
    "from docx import Document\n",
    "import xlrd\n",
    "\n",
    "\n",
    "def change_text(old_text, new_text):\n",
    "    all_paragraphs = document.paragraphs\n",
    "    for paragraph in all_paragraphs:\n",
    "        for run in paragraph.runs:\n",
    "            run_text = run.text.replace(old_text, new_text)\n",
    "            run.text = run_text\n",
    "\n",
    "    all_tables = document.tables\n",
    "    for table in all_tables:\n",
    "        for row in table.rows:\n",
    "            for cell in row.cells:\n",
    "                cell_text = cell.text.replace(old_text, new_text)\n",
    "                cell.text = cell_text\n",
    "\n",
    "\n",
    "xlsx = xlrd.open_workbook('Excel_Files/合同信息表.xlsx')\n",
    "sheet = xlsx.sheet_by_index(0)\n",
    "\n",
    "for table_row in range(1, sheet.nrows):\n",
    "    document = Document(\"Word_Files/修改模板.docx\")\n",
    "    for table_col in range(0, sheet.ncols):\n",
    "        change_text(str(sheet.cell_value(0, table_col)), str(sheet.cell_value(table_row, table_col)))\n",
    "\n",
    "    document.save(\"Word_Files/%s合同.docx\" % str(sheet.cell_value(table_row, 2)))\n",
    "    print(\"%s合同完成\" % str(sheet.cell_value(table_row, 2)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "and so on。。。。。。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 学完本课程之后，你会：\n",
    "    1、 掌握基本的python语法，并编写简单的python程序\n",
    "    2、 可以阅读别人写的python代码\n",
    "    3、 编写简单的爬虫\n",
    "    4、 进行基本的数据分析"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 机器学习需要：\n",
    "    1、 数学理论知识  (统计、线性代数、微积分 。。。)\n",
    "    2、 编程能力（python)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### python的特性\n",
    "    1、python语法简单，容易理解，容易学习\n",
    "    2、跨平台，可在windows/linux/mac os等系统上运行\n",
    "    3、可以做网站、爬虫、大数据处理、机器学习\n",
    "    4、拥有强大、丰富的第三方库  numpy、pandas ..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello, \"world\n"
     ]
    }
   ],
   "source": [
    "print('hello, \"world')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello, 'world\n"
     ]
    }
   ],
   "source": [
    "print(\"hello, 'world\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Zen of Python, by Tim Peters\n",
      "\n",
      "Beautiful is better than ugly.\n",
      "Explicit is better than implicit.\n",
      "Simple is better than complex.\n",
      "Complex is better than complicated.\n",
      "Flat is better than nested.\n",
      "Sparse is better than dense.\n",
      "Readability counts.\n",
      "Special cases aren't special enough to break the rules.\n",
      "Although practicality beats purity.\n",
      "Errors should never pass silently.\n",
      "Unless explicitly silenced.\n",
      "In the face of ambiguity, refuse the temptation to guess.\n",
      "There should be one-- and preferably only one --obvious way to do it.\n",
      "Although that way may not be obvious at first unless you're Dutch.\n",
      "Now is better than never.\n",
      "Although never is often better than *right* now.\n",
      "If the implementation is hard to explain, it's a bad idea.\n",
      "If the implementation is easy to explain, it may be a good idea.\n",
      "Namespaces are one honking great idea -- let's do more of those!\n"
     ]
    }
   ],
   "source": [
    "import this"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "python之禅  \n",
    "                作者：Tim Peters\n",
    "\n",
    "优美胜于丑陋                                                  Python 以编写优美的代码为目标\n",
    "明了胜于晦涩                                                  优美的代码应当是明了的，命名规范，风格相似 \n",
    "简洁胜于复杂                                                  优美的代码应当是简洁的，不要有复杂的内部实现 \n",
    "复杂胜于凌乱                                                  如果复杂不可避免，那代码间也不能有难懂的关系，要保持接口简洁 \n",
    "扁平胜于嵌套                                                  优美的代码应当是扁平的，不能有太多的嵌套\n",
    "间隔胜于紧凑                                                  优美的代码有适当的间隔，不要奢望一行代码解决问题 \n",
    "可读性很重要                                                  优美的代码是可读的 \n",
    "即便假借特例的实用性之名，也不可违背这些规则                        这些规则至高无上 \n",
    "不要包容所有错误，除非你确定需要这样做                             精准地捕获异常，不写 except:pass 风格的代码 \n",
    "当存在多种可能，不要尝试去猜测 \n",
    "而是尽量找一种，最好是唯一一种明显的解决方案                        如果不确定，就用穷举法\n",
    "虽然这并不容易，因为你不是Python之父                             这里的 Dutch 是指 Guido \n",
    "做也许好过不做，但不假思索就动手还不如不做                          动手之前要细思量\n",
    "如果你无法向人描述你的方案，那肯定不是一个好方案；反之亦然             方案测评标准\n",
    "命名空间是一种绝妙的理念，我们应当多加利用                          倡导与号召"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
